SRC_DIR := Core
BUILD_SRC_DIR := $(BUILD_DIR)/$(SRC_DIR)
$(BUILD_SRC_DIR): | $(BUILD_DIR)
	mkdir $@


include $(SRC_DIR)/Firmware/build.mk
# include $(SRC_DIR)/FreeRTOS/build.mk
include $(SRC_DIR)/main/build.mk
include $(SRC_DIR)/BSP/build.mk
include $(SRC_DIR)/FATFS/build.mk

SETUPASM := $(SRC_DIR)/startup.S
TMPASM_O := $(addprefix $(BUILD_SRC_DIR)/,startup.o)

$(TMPASM_O): $(SETUPASM) | $(BUILD_SRC_DIR)
	$(info build $(OBJ_COUNT) $@)
	$(eval OBJ_COUNT = $(shell echo $$(($(OBJ_COUNT) + 1))))
	@$(AS) -c $(ASFLAGS) $< -o $@

OBJS += $(TMPASM_O)